package com.lg.mengbase.testBottonTab;

import android.support.v4.app.Fragment;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;

import com.lg.baselibrary.activity.BaseBottomFrameLayoutTabActivity;
import com.lg.baselibrary.widget.TabItemView;
import com.lg.mengbase.R;
import com.lg.mengbase.TestKeyboardListenerAty;
import com.lg.mengbase.testBottonTab.fragment.TabFragment1;
import com.lg.mengbase.testBottonTab.fragment.TabFragment2;
import com.lg.mengbase.testBottonTab.fragment.TabFragment3;
import com.lg.mengbase.testBottonTab.fragment.TabFragment4;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by ligang on 2017/6/3.
 * description：
 */

public class TestBottomTabViewActivity2 extends BaseBottomFrameLayoutTabActivity{
    @Override
    protected List<TabItemView> getTabViews() {
        List<TabItemView> tabItemViews = new ArrayList<>();
        tabItemViews.add(new TabItemView(this,"首页", R.color.bottom_tab_text_def,
                R.color.bottom_tab_text_selected,R.mipmap.home_n,R.mipmap.home_p));
        tabItemViews.add(new TabItemView(this,"悄悄话",R.color.bottom_tab_text_def,
                R.color.bottom_tab_text_selected,R.mipmap.tabbar_icon_talk_n,R.mipmap.tabbar_icon_talk_p));
        tabItemViews.add(new TabItemView(this,"发现",R.color.bottom_tab_text_def,
                R.color.bottom_tab_text_selected,R.mipmap.tabbar_icon_discovery_n,R.mipmap.tabbar_icon_discovery_p));
        tabItemViews.add(new TabItemView(this,"设置",R.color.bottom_tab_text_def,
                R.color.bottom_tab_text_selected,R.mipmap.set_n,R.mipmap.set_p));
        Animation animation = AnimationUtils.loadAnimation(this,R.anim.anim_tab);
        for(TabItemView tabItemView:tabItemViews){
            tabItemView.setAnimation(animation);
        }
        return tabItemViews;
    }

    @Override
    protected List<Fragment> getFragments() {
        List<Fragment> fragments = new ArrayList<>();
        fragments.add(new TabFragment1());
        fragments.add(new TabFragment2());
        fragments.add(new TabFragment3());
        fragments.add(new TabFragment4());
        return fragments;
    }

    @Override
    protected void setCenterView() {
        super.setCenterView();
        final Animation centerAnimation = AnimationUtils.loadAnimation(this,R.anim.anim_bottom_centerview_press);
        centerAnimation.setAnimationListener(new Animation.AnimationListener() {
            @Override
            public void onAnimationStart(Animation animation) {
            }

            @Override
            public void onAnimationEnd(Animation animation) {
                startActivity(TestKeyboardListenerAty.class);
            }

            @Override
            public void onAnimationRepeat(Animation animation) {
            }
        });
        setCenterView(R.layout.v_bottom_tab_centerview2, new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                v.startAnimation(centerAnimation);
            }
        });
    }

    @Override
    protected void initData() {

    }
}
